<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="templates/template.xhtml">
        <h:head>
            <title>Esquemas</title>
        </h:head>
        <ui:define name="content">
            <h:body>
                <h:form>
                    <p:growl id="messages" />
                    <!-- Tabela -->

                    <center>
                        <p:dataTable id="resultado" var="esquema" value="#{esquemaBean.esquemas}"  
                                     selection="#{esquemaBean.esquema}" selectionMode="single" update="panel">

                            <f:facet name="header">
                                #{msgs.listaesquemas}
                            </f:facet>

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.nome}"/>
                                </f:facet>
                                <h:outputText value="#{esquema.nome}"/>
                            </p:column>


                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.categoria}"/>
                                </f:facet>
                                <h:outputText value="#{esquema.categoria}"/>
                            </p:column>


                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.nomeprojeto}"/>
                                </f:facet>
                                <h:outputText value="#{esquema.nomeProjeto}"/>
                            </p:column>

                        </p:dataTable>
                    </center>

                    <!--Botões-->
                    <br> 
                        <center>
                            <p:commandButton id="excluir" value="#{msgs.excluir}" onclick="confirmation.show()" update="panel,resultado" 
                                             image="ui-icon ui-icon-trash" title="Excluir" process="@this,panel,resultado">
                                <p:confirmDialog message="Deseja excluir este registro?" />
                            </p:commandButton>

                            <p:confirmDialog message="#{msgs.desejaexcluir}"  
                                             showEffect="bounce" hideEffect="explode"  
                                             header="#{msgs.desejaexcluir}" severity="alert" widgetVar="confirmation">  

                                <center>
                                <p:commandButton value="#{msgs.sim}" oncomplete="confirmation.hide()"  
                                                 actionListener="#{esquemaBean.excluir()}" update="panel,resultado" process="@this,panel,resultado"/>  
                                <p:commandButton value="#{msgs.nao}" onclick="confirmation.hide()" type="button" />   
                                </center>
                            </p:confirmDialog>

                            <p:commandButton value="#{msgs.alterarEsquemas}" image="imagens/new_project.png" action="editarEsquema.xhtm" ajax="false">
                                <f:param name="productId" value="20"/>
                            </p:commandButton>
                        </center>
                    </br>
                    <!-- Painel -->
                    <center>
                        <p:panel id="panel" header="#{msgs.esquemadetalhado}">  
                            <h:panelGrid columns="3">  


                                <h:outputLabel for="nome" value="#{msgs.nome}: *" />  
                                <p:inputText id="nome"  value="#{esquemaBean.esquema.nome}" size="50" requiredMessage="Campo obrigatório"
                                             required="true" label="Novo Projeto" disabled="true"/>
                                <p:message for="nome" />  


                                <h:outputLabel for="descricao" value="#{msgs.descricao}: *"/>
                                <p:inputTextarea id ="descricao" rows="3" style="width: 423px" value="#{esquemaBean.esquema.descricao}" 
                                                 required="true" label="Descrição" requiredMessage="#{msgs.campoobrigatorio}" disabled="true">
                                </p:inputTextarea>
                                <p:message for="descricao" />  

                                <h:outputLabel for="categoria" value="#{msgs.categoria}: *"/>
                                <p:inputText id="categoria" 
                                             value="#{esquemaBean.esquema.categoria}" size="50" 
                                             required="true" label="Categoria" requiredMessage="#{msgs.campoobrigatorio}" disabled="true">
                                </p:inputText> 
                                <p:message for="categoria" />  

                                <h:outputLabel for="bancodado" value="#{msgs.bancodados}: *"/>
                                <p:inputText id="bancodado" 
                                             value="#{esquemaBean.esquema.nomeBd}" size="50" 
                                             required="true" label="Banco de Dados" requiredMessage="#{msgs.campoobrigatorio}" disabled="true">
                                </p:inputText> 
                                <p:message for="bancodado" /> 

                                <h:outputLabel for="projeto" value="#{msgs.nomeprojeto}: *"/>
                                <p:inputText id="projeto" 
                                             value="#{esquemaBean.esquema.nomeProjeto}" size="50" 
                                             required="true" label="projeto" requiredMessage="#{msgs.campoobrigatorio}" disabled="true">
                                </p:inputText> 
                                <p:message for="projeto" /> 
                            </h:panelGrid>  
                        </p:panel>   
                    </center>


                    <!-- Botões -->

                    <br>
                        <center>
                            <p:commandButton value="#{msgs.novoesquema}" image="imagens/new_project.png" action="novoEsquema.xhtml" ajax="false">
                                <f:param name="productId" value="20"/>
                            </p:commandButton>

                            <p:commandButton value="#{msgs.pesquisar}" image="imagens/new_project.png" action="pesquisar.xhtm" ajax="false">
                                <f:param name="productId" value="20"/>
                            </p:commandButton>
                            <p:commandButton value="#{msgs.voltar}" image="imagens/new_project.png" action="login.xhtm" ajax="false"/>
                            <f:param name="productId" value="20"/>
                        </center>
                    </br>

                </h:form>

            </h:body>
        </ui:define>

    </ui:composition>
</html>